import React,{Suspense,lazy} from 'react'
import ReactDOM from 'react-dom'
import { BrowserRouter as Browser,Switch,Route } from 'react-router-dom'
import Routes from '@modules/Routes'
import {RouteList} from './routes'
import "@css/index.css"
import "antd/dist/antd.css"
const LoadingCom = ()=>{
  return <div></div> //<Spin spinning={true}></Spin>
}
const App = props=>{
	return <Browser>
		<Suspense fallback={<LoadingCom />}>  
	    <Switch>
	      {
	        RouteList.map((item,i)=>{
	          const Com = lazy(item.component)
	          return (
	            <Route
	              key={i}
	              path={item.path}
	              render={({match,location,history})=>{
	                return <Com {...match} location={location} history={history} />
	              }}
	            />
	          );
	        })
	      }
	    </Switch>
	  </Suspense>
	</Browser>
}
ReactDOM.render(<App />, document.getElementById('root'));